import request from '@/utils/request'
import type { PageParam, ResponseData } from '../commonType'

enum API {
  ALL_URL = '/t-customer-info/getAll',
  INFO_URL = '/t-customer-info/getById',
  PAGE_URL = '/t-customer-info/getPage',
  ADD_URL = '/t-customer-info/add',
  EDIT_URL = '/t-customer-info/update',
  DELETE_URL = '/t-customer-info/delete',
}

export function customerGetAll(id: string | number) {
  return request.get<any, ResponseData>(API.ALL_URL)
}

export function customerGetById(id: string | number) {
  return request.get<any, ResponseData>(`${API.INFO_URL}/${id}`)
}

export function customerGetPage(data: PageParam) {
  return request.get<any, ResponseData>(API.PAGE_URL, { params: data })
}

export function customerAdd(data: any) {
  return request.post<any, ResponseData>(API.ADD_URL, data)
}

export function customerEdit(data: any) {
  return request.put<any, ResponseData>(API.EDIT_URL, data)
}

export function customerDelete(data) {
  return request.delete<any, ResponseData>(API.DELETE_URL, { params: data })
}
